package com.tankbattle.view;

class A {
    public int num = 10;
    public void show() {
        System.out.println("A: " + num);
    }
}

class B extends A {
    public int num = 20; // Hides A's num, this is field hiding (not overriding)
    public void show() {
        System.out.println("B: " + num); // Refers to B's num
    }
}

public class Test {
    public static void main(String[] args) {
        A a = new B(); // Polymorphism: A reference to B object
        System.out.println(a.num); // Accessing field 'num' via A reference
        a.show(); // Calling method 'show()' via A reference
    }
}